
#ifndef __AES_SYMMETRIC_KEY_H
#define __AES_SYMMETRIC_KEY_H

#include "EncryptionKey.h"
#include "DecryptionKey.h"
#include "SymmetricKey.h"

// This cheats slightly, using the base64 'key' simply as a password
// and expecting the hash to be good!
#define INITIALISATION_VECTOR "\x24\x3f\x6a\x88\x85\xa3\x08\xd3\x13\x19\x8a\x2e\x03\x70\x73\x44" \
                              "\xa4\x09\x38\x22\x29\x9f\x31\xd0\x08\x2e\xfa\x98\xec\x4e\x6c\x89"

/** An class encapsulating a symmetric key to be used in AES
 * encryption and decryption. */
class AESSymmetricKey : public EncryptionKey, public DecryptionKey, public SymmetricKey
{
   public:
      AESSymmetricKey();
      AESSymmetricKey(const char *name);
      AESSymmetricKey(int bits, const char *name);
      AESSymmetricKey(const AESSymmetricKey &other);
      AESSymmetricKey &operator=(const AESSymmetricKey &other);
      ~AESSymmetricKey();
      int importKeyFromASCII(const char *text, const char *name);
      int exportKeyToASCII(char **text) const;
      int importKeyFromASCIIWithPassword(const char *text, const char *password, const char *name);
      int exportKeyToASCIIWithPassword(char **text, const char *password) const;
      int compareKeyEqual(SymmetricKey *symkey) const;
      static const keytypetype getStaticKeyType() { return KEY_TYPE_SYMM_AES; }
      const keytypetype getKeyType() const;
      /** Get the encapsulated key data. */
      const char *getKeyData() const { return keypassword; }
   private:
      /** The actual key data bit string. */
      char *keypassword;
};

#endif
